package com.h3bpm.handler;

import OThinker.Common.Organization.Models.Unit;
import OThinker.Common.Organization.Models.User;
import OThinker.H3.Entity.EventHandlers.IOrganizationEventHandler;
import OThinker.H3.Entity.IEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OrganizationHandler implements IOrganizationEventHandler {
    private static final Logger logger = LoggerFactory.getLogger(OrganizationHandler.class);
    @Override
    public void OnCreated(IEngine engine, Unit item) {
        User user  = (User)item;
        logger.info("《》@组织机构 OnCreated {} ,code {}", user.toString(), user.getCode());
        PushToPortal.pushUser(engine, user, "1");
    }

    @Override
    public void OnUpdated(IEngine engine, Unit item) {
        User user  = (User)item;
        logger.info("《》@组织机构 OnUpdated {}  ,code {}", user.toString(), user.getCode());
        String flag = PushToPortal.getFlag(engine, user);
        PushToPortal.pushUser(engine, user, flag);
    }

    @Override
    public void OnRemoved(IEngine engine, String ObjId) throws Exception {

    }
}
